home *** CD-ROM | disk | FTP | other *** search
- BASCONV--A FORTRAN-TO-BASIC CONVERSION AID
- BY JIM GLASS
-
-
- BASCONV is a program for converting IBM-PC Basic programs into
- Microsoft or IBM Fortran. It will not perform every detail of the
- conversion for you, but will perform the bulk of the drudgery.
- Careful inspection and editing of the resulting output file are
- vital if you wish to obtain a working Fortran program.
-
- BASCONV is easy to use. It asks you for the name of the source
- (Basic) file, the target (Fortran) file, and if you wish to have
- the source displayed as it is being converted. All file names
- must be supplied complete with drive identifier and extension, if
- any. In addition to these files, BASCONV also builds a working
- file, called WORK, on the current default drive. It DOES NOT
- delete the WORK file when the conversion is complete.
-
- BASCONV is fairly smart. Among the things it can do are:
-
- Change FOR/NEXT loops into DO loops.
- BASCONV supplies target line numbers for
- the terminating CONTINUE if necessary.
-
- Change WHILE/WEND loops into IF..CONTINUE
- loops.
-
- Change ON n GOTO statements into GOTO
- (...) n type statements. ON...GOSUB and
- GOSUBS in general are NOT converted.
-
- Fully parse IF..THEN..ELSE statements and
- convert into equivalent Fortran logical
- IF statements or IF blocks. An IF without
- an ELSE becomes a pure logical IF.
-
- Handle OPEN..FOR..AS and OPEN
- mode,file,... statements, converting them
- into Fortran OPEN statements.
-
- Detect ALL implicit declarations of
- variables, and provide explicit
- declarations at the beginning of the
- Fortran source.
-
- Convert all keywords, such as ATN, to
- equivalents, such as ATAN. Also parse
- statements such as x MOD y and convert
- into statements such as AMOD(x,y).
-
- Remove all Basic line numbers, except
- where lines are explicitly referenced.
- These line numbers become Fortran
- statement labels.
-
- Break all mulit-statement Basic lines
- into single statements and move all
- source code into column seven as required
- by Fortran.
-
- Convert all double-quotes (") into single
- quotes (').
-
- Convert Basic exponentiation (^) into
- Fortran exponentiation (**).
-
- Provide Fortran statement functions for
- the Basic logical functions IMP, XOR, and
- EQV.
-
- Converts PRINT and LPRINT as well as
- PRINT# and WRITE# statements into Fortran
- equivalents.
-
- Inserts appropriate code to convert the
- Basic SWAP keyword into Fortran
- statements.
-
- Converts all Basic relational operators
- such as <,>,=,NOT,AND,OR into equivalent
- Fortran such as
- .LE.,.GT.,.EQ.,.NOT.,.AND.,.OR.
-
- Some things BASCONV (at least version 1.0) CANNOT do are:
-
- Convert Basic graphics commands such as
- LINE, PSET, PRESET.
-
- Convert GOSUBS into CALLS
-
- Convert PRINT USING into WRITE with
- FORMAT.
-
- Handle DATA/RESTORE/READ statements.
-
- Handle CHAIN, LSET, MKI$, CVI,
- statements.
-
- Handle sceen positioning statements like
- POS(0), CSRLIN.
-
-
- Here is a list of the Basic keywords which ARE NOT converted by
- BASCONV:
-
- AUTO BLOAD BSAVE CALL CHAIN CIRCLE CLEAR CLS
- COLOR COM COMMON CONT CSRLIN CVD CVI DATA
- DATE$ DELETE DRAW EDIT ERASE ERL ERR ERROR
- FIELD FILES FRE GET GOSUB HEX$ INKEY$ INP
- INPUT$ INSTR KEY KEY$ KILL LEFT$ LEN LINE
- LIST LLIST LOAD LOC LOCATE LOF LPOS LSET
- MERGE MID$ MKD$ MKI$ MKS$ MOTOR NAME NEW
- OCT$ OFF OPTION OUT PAINT PEEK PEN PLAY
- POINT POS PRESET PSET PUT RANDOMIZE RENUM
- RESTORE RESUME RIGHT$ RND RESET RUN SAVE SCREEN
- SOUND SPACE$ SPC( STICK STRIG STRING$ SYSTEM TAB(
- TIME$ TROFF TRON USING USR VAL VARPTR VARPTR$
- WAIT WIDTH
-
- Finally, here is a list of the Basic keywords which ARE handled
- by BASCONV:
-
- ABS AND ASC ATN CDBL CHR$ CINT CLOSE
- COS CSNG DEF DEFDBL DEFINT DEFSNG DEFSTR DIM
- ELSE END EQV EXP FIX FNxxxx FOR GOTO
- IF IMP INPUT INPUT# INT LET LOG LPRINT
- MOD NEXT NOT ON..GOTO OPEN OR PRINT PRINT#
- REM RETURN SGN SIN SQR STEP STOP STR$
- SWAP TAN THEN TO WEND WHILE WRITE WRITE#
- XOR
-
- Although the list of keywords recognized by BASCONV is shorter
- than those not recognized, the most important are there. Many of
- the unrecognized words are those with no Fortran equivalents,
- such as LINE or PAINT. A few are not handled due to the
- difficulty of programming the conversion, such as
- DATA/READ/RESTORE. Perhaps in Version 1.1...